refactor: tanstack-query for api state, zustand for accounts and settings state#2637
Draft
setchy wants to merge 4 commits into
Draft
refactor: tanstack-query for api state, zustand for accounts and settings state#2637setchy wants to merge 4 commits into
setchy wants to merge 4 commits into
Conversation
76ae87a to
61581b7
Compare
61581b7 to
6881e49
Compare
6881e49 to
b270e74
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Completes the renderer state-management migration started with the filters store (#2633): TanStack Query owns all API state, Zustand stores own all client state, and
AppContextis gone.refetchInterval), caching, retries, and mutations (mark as read/done, unsubscribe), replacing the manualuseState/timer-based fetching inuseNotifications.useAccountsStore) and settings (useSettingsStore) state, joining the existing filters store. Both persist to their own local storage keys, with a one-time migration from the legacygitify-storagekey.AppContextis fully retired. Components consume focused hooks directly:useNotifications()(shared query cache),useLogins()(forge login/logout flows),useOnlineStatus(), and a small transient store for global-shortcut registration state. A one-mountGlobalEffectscomponent hosts app-level side effects (theme, tray, shortcut registration, app reset, account refresh, notification alerts).Details
select, so narrowing and loosening filters applies instantly with zero API calls. Enrichment is limited to filter-passing notifications to bound API usage.stores/subscriptions.ts, initialized once on app startup.utils/auth/utilslogic (multi-forge upsert, scope checks), sanitizes persisted state on rehydrate, and owns token re-encryption migration (run once before the first account refresh).fetchTypesetting: interval mode maps to TanStack Query'srefetchInterval; inactivity mode reusesuseInactivityTimer.onlineManagerthrough the renderer to the tray (ITrayColorUpdateIPC payload) instead of pollingnet.isOnline()in the main process, and surfaces anOFFLINEerror state in the UI.@octokit/plugin-retryremoved; retries are handled at the query layer (queries and mutations).useIntervalTimerremoved (superseded by query polling).renderWithProvidersoptions API, now backed by globally mocked hooks (__helpers__/hook-mocks.ts) plus direct store seeding; hook tests exercise the real implementations viavi.unmock.